﻿@using JuCheap.Infrastructure.Extentions
@using JuCheap.Models.Enum
@model List<JuCheap.Models.MenuDto>
<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="nav-close">
        <i class="fa fa-times-circle"></i>
    </div>

    <div class="sidebar-collapse">
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <h1 style="font-size: 2em; color: white; text-align: center">JuCheap</h1>
                </div>
                <div class="logo-element">
                    Ju3
                </div>
            </li>
            @if (Model.AnyOne())
            {
                foreach (var module in Model.OrderBy(x => x.Order).Where(x => x.Type == MenuType.Module))
                {
                    <li>
                        <a href="#">
                            <i class="@(module.Icon.IsBlank() ? "fa fa-tv" : module.Icon)"></i>
                            <span class="nav-label">@module.Name</span>
                            <span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level">
                            @foreach (var menu in Model.OrderBy(x => x.Order).Where(x => x.ParentId == module.Id))
                            {
                                <li>
                                    <a class="J_menuItem" href="@menu.Url" data-index="@menu.Id">
                                        <i class="@(menu.Icon.IsBlank() ? "fa fa-angle-right" : menu.Icon)"></i>
                                        @menu.Name
                                    </a>
                                </li>
                            }
                        </ul>

                    </li>
                }
            }
        </ul>
    </div>

    <div class="sidebar-footer">
        <a id="btnChangeMenu"><span class="fa fa-reorder"></span></a>
        <a class="hidden-small"><span class="fa fa-desktop"></span></a>
        <a class="hidden-small"><span class="fa fa-lock"></span></a>
        <a class="hidden-small" href="@Url.Action("Logout","Home")"><span class="fa fa-power-off"></span></a>
    </div>
</nav>
